//创建路由规则
import { createRouter,createWebHashHistory } from "vue-router"
const routes=[
    {
        path:"/login",
        name:"login",
        component:()=>import("../views/login/index.vue")
    },
    {
        path:"/test",
        name:"test",
        component:()=>import("../views/test/index.vue")
    },
    {
        path:"/test2",
        name:"test2",
        component:()=>import("../views/test/index2.vue")
    },
    {
        path:"/search",
        name:"search",
        component:()=>import("../views/search/index.vue")
    },
    {
        path:'/article/:articleId',
        name:"article",
        component:()=>import("../views/article/index.vue"),
        props:true
    },
    {
        path:"/",
        name:'layout',
        component:()=>import("../views/layout/index.vue"),
        children: [
            {
                path: "",
                name: "home",
                component: () => import('../views/home/index.vue')
            },
            {
                path: "/question",
                name: "question",
                component: () => import('../views/question/index.vue'),
            },
            {
                path: "/video",
                name: "video",
                component: () => import("../views/video/index.vue")
            },
            {
                path: "/my",
                name: "my",
                component: () => import("../views/my/index.vue"),

            }
            
        ]
    }
];

//创建路由实例

const router=createRouter({
    //create web history
    history:createWebHashHistory(),
    routes
});
export default router;

//创建登录组件
//指定出口

